<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id')->comment('用户表');
            $table->string('user_name', 64)->nullable()->comment('用户名');
            $table->string('real_name', 255)->nullable()->comment('真实姓名');
            $table->string('user_pwd', 255)->nullable()->comment('登录密码');
            $table->string('phone_num', 32)->nullable()->comment('手机号码');
            $table->string('id_num', 32)->nullable()->comment('身份证号码');
            $table->string('address_region', 255)->nullable()->comment('所处地（省市区镇村）');
            $table->string('address_detailed', 255)->nullable()->comment('详细地址');
            $table->string('head_portrait', 255)->nullable()->comment('用户头像');
            $table->string('person_profile', 255)->nullable()->comment('个人简介');
            $table->integer('fans_num')->nullable()->comment('粉丝数')->default(0);
            $table->integer('follow_num')->nullable()->comment('关注数')->default(0);
            $table->integer('article_num')->nullable()->comment('发文数')->default(0);
            $table->integer('integral_num')->nullable()->comment('积分数量')->default(0);
            $table->integer('coins_num')->nullable()->comment('金币数量')->default(0);
            $table ->tinyInteger('sex') ->default('0') ->comment('性别 （男1、女2）');
            $table ->tinyInteger('role') ->default('0') ->comment('用户角色 （普通用户0、振兴员1、服务专家2）');
            $table ->integer('service_catid') ->default('0') ->comment('所属服务分类ID');
            $table ->char('region_code') ->nullable() ->comment('地区代码');
            $table->integer('inviter_user_id')->nullable()->comment('邀请人ID')->default(0);
            $table->string('wx_id', 255)->nullable()->comment('微信ID');
            $table->string('qq_id', 255)->nullable()->comment('QQID');
            $table->string('wb_id', 255)->nullable()->comment('微博ID');
            $table->dateTime('last_login_time')->nullable()->comment('');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
